package main.java.io;

import java.io.Serializable;
import java.util.Arrays;

/**
 * 序列化与反序列化使用的类必须实现Serializable接口
 */
public class Person implements Serializable {
    private static final long serialVersionUID = 1L;

    private String name;
    private int age;
    private String sex;
    private String[] otherInfo;

    public Person(String name, int age, String sex, String[] otherInfo) {
        this.name = name;
        this.age = age;
        this.sex = sex;
        this.otherInfo = otherInfo;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", sex='" + sex + '\'' +
                ", otherInfo=" + Arrays.toString(otherInfo) +
                '}';
    }
}
